﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using fcwms.Common;

public partial class admin_index : SessionManage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //返回用户编号，角色名称
            lblUser_id.Text = Session["username"].ToString();
            int role_id = int.Parse(Session["roleid"].ToString());
            fcwms.BLL.dt_role bll = new fcwms.BLL.dt_role();
            lbl_Role.Text = bll.GetTitle(role_id);

            fcwms.BLL.dt_users bll2 = new fcwms.BLL.dt_users();
            lblUserName.Text = bll2.GetTitle(Session["username"].ToString());


            //fcwms.Model.dt_role model = bll.GetTitle(role_id);
            //string selRoleName = "select role_name from dt_role where id = @role_id";              
            //SqlParameter[] parms = new SqlParameter[] {
            //    new SqlParameter("@role_id",role_id)           
            //};
            ////DataSet dt = DbHelperSQL.Query(sel1, parms);
            ////lbl_Role.Text = dt.Tables[0].Rows[0]["role_name"].ToString();
            //lbl_Role.Text = DbHelperSQL.GetSingle(selRoleName, parms).ToString();         
        }
    }
    protected void lbtnExit_Click(object sender, EventArgs e)
    {
        Session.Abandon(); 　　//取消当前会话

        Session.Clear();    //清除当前浏览器进程所有session 

        ////Response.Write("<script>window.top.opener=null;window.top.location='login.aspx';</script>");
        ////Response.Write("<script>window.location.href='login.aspx';</script>");
        //Response.Redirect("login.aspx");
        Response.Redirect("login.aspx");
    }
}